home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr52 / clpshare.zip / SHARE.C next >
Text File  |  1993-04-20  |  2KB  |  44 lines

  1. /****************************************************************************
  2. *  Program........:  SHARE.C   (Clipper Function)                           *
  3. *  Author.........:  Scott C. Hansen                                        *
  4. *  Date...........:  06/07/88                                               *
  5. *  Version........:  1.0                                                    *
  6. *  Notes..........:  Flags file as shareable under the Novell Netware       *
  7. *                 :  shell.                                                 *
  8. *  Returns........:  A logical is ret if file is changed or already         *
  9. *                 :  flagged as shareable.                                  *
  10. ****************************************************************************/
  11.  
  12. #include <nandef.h>
  13. #include <extend.h>
  14. #include <dos.h>
  15. #include <io.h>
  16. #define SHAREABLE 0X80  /* Bit mask for the 7th bit (2 to the 7th) */
  17.  
  18. CLIPPER share()
  19. {
  20.   char     *fname[1];          /* File name pointer                */
  21.   unsigned attribute;          /* File attribute flag              */
  22.   int      fh;                 /* File handle                      */
  23.   int      fflag;              /* Clipper Boolean                  */
  24.  
  25.   fflag=1;                       /* Initialize as True             */
  26.   fname[0]=_parc(1);             /* File name from Clipper         */
  27.   if ((access(fname[0],00))      == -1)  /* Check if file exists   */
  28.      fflag=0;                            /* If not flag as False   */
  29.  
  30.   if (fflag ==1) {             /* If file exists go to work        */
  31.     _dos_setfileattr(fname[0],SHAREABLE); /* Flag the 7th bit ON,
  32.                                            shareable */
  33.     _dos_getfileattr(fname[0],&attribute);
  34.                              /* Capture current attribute          */
  35.     if ((attribute & SHAREABLE) != 0)
  36.                                /* Exclusive AND to test change     */
  37.        fflag=1;                /* Attrib. changed, return True     */
  38.       else
  39.        fflag=0;                /* Not changes, return False        */
  40.  
  41.   }
  42.   _retl(fflag);                /* Return boolean to Clipper        */
  43.   _ret();
  44. }